#!/usr/bin/perl
use warnings;
use strict;
# Open the input file
if(!open(DATA_FILE, "expression.txt")){
    die "Unable to open expression.txt for reading\n";
}
# open the output file for wrinting
if(!open(WRITE_FILE, ">correct_expression.txt")){
    die "Unable to open correct_expression.txt for writing\n";
} 
# Loop through all lines and write out the correct line
while(my $fileLine = <DATA_FILE>){ 
	#Substitute NA with 0 . Demand that NA be enclosed by white characters(space, tab 
	#or newline). Make the substitution global.
    $fileLine =~ s/(\S*)NA(\S*)/0$2/g;
    print(WRITE_FILE "$fileLine");
    print("$fileLine");
}
close(DATA_FILE);
close(WRITE_FILE); 